const express = require("express");
const multer = require("multer");
const router = express.Router();
const { uploadFileService } = require("../service/uploadFileService");
const { uploading, formatResponse } = require("../utils/tool");

router.post("/",async function(req,res,next){
    // uploading.single("file")(req,res,function(err){
    //     if(err instanceof multer.MulterError){
    //       next(new UploadError("上传文件失败,请检查文件的大小,控制在2MB以内"))
    //     }else{
    //         console.log(req,'rrrrrr');
    //         const resp = {
    //             msg:"上传文件成功",
    //             path:"/static/uploads"
    //         }
    //         res.send(formatResponse(0,"",resp.path))
    //     }
    // })
    const result = uploadFileService()
    console.log(result,'result');
})

module.exports = router